<template>
  <div>
    <h1>Parent</h1>
    <Child  ref='child'/>
    <button @click="updateChild">修改子组件的数据</button>
  </div>
</template>

<script>
import Child from "./Child";
export default {
  name: "Parent",
  
  components: {
    Child,
  },
  methods:{
    updateChild(){
      console.log(this.$refs);
      this.$refs.child.num +=3
    }
  }
};
</script>

<style>
</style>